<?php
/**
 * Supplier Dispatch
 */
class SD extends AppModel {
    var $name = 'SD';

    var $useTable = 'supplier_dispatches';

    const ITS_STOCK_OUT_TYPE = 'SD';

    var $belongsTo = array('Product',
            'CPS' => array(
                            'foreignKey' => 'cust_product_site_id'
            ),
            'CustProductSite' => array(
                            'foreignKey' => 'cust_product_site_id'
            ),
    );

    var $validate = array(
            'qty' => array(
                            'rule' => 'numeric',
                            'message' => 'Please input product quantity',
                            'on' => 'create'
            ),
    );

    var $hasMany = array(
            'ProductSerial' => array(
                            'foreignKey' => 'its_stock_out_id',
                            'conditions' => array(
                                            'its_stock_out_type' => self::ITS_STOCK_OUT_TYPE
                            )
            )
    );
}
?>
